package com.huilan.hgt.util;

import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.StandardCharsets;
import java.util.Objects;
import java.util.Properties;

/**
 * @Author lplu
 * @date 2018/6/8
 */
public class SystemConfigUtil {
    /**
     * 获取配置文件信息
     * @Author: lplu
     * @Date: 2018/6/8 14:43
     * @param param
     * @return:
     */
    public static String getConfig(String param){
        Properties prop = new Properties();
        String obj = "";
        try (Reader is = new InputStreamReader(new FileInputStream(Objects.requireNonNull(SystemConfigUtil.class
                .getClassLoader().getResource("systemConfig.properties")).getPath()), StandardCharsets.UTF_8)) {
            prop.load(is);
            obj = prop.getProperty(param);
        }catch (Exception e){
            System.out.println("读取配置文件失败");
            e.printStackTrace();
        }
        return obj;
    }
}
